import { CopyInfoPanelBase } from "../copy/CopyInfoPanelBase";
import { Language } from "../../../../extend/language/Language";
import { SCountryMoneyCopyInfo } from "../../../../Message/Public/SCountryMoneyCopyInfo";
import { ClockManager } from "../../manager/ClockManager";
import { ObjCreate } from "../common/ObjCreate";
import { GlobalStyle } from "../../../common/global/GlobalStyle";
import { ImagesConst } from "../../resource/ImagesConst";
import { Dispatcher } from "../../../mvc/core/Dispatcher";
import { DataEvent } from "../../events/DataEvent";
import { EventName } from "../../mvc/EventName";
import { SecTimerView } from "../common/SecTimerView";
import { GTextFiled } from "../../../../com/mui/controls/GTextFiled";
//class CountryMoneyCopyInfoPanel
    
    export  class CountryMoneyCopyInfoPanel extends CopyInfoPanelBase
    {
        constructor(arg1: string="MagicTowerInfoButtonBg")
        {
            super(arg1);
            title = Language.getString(80450);
            return;
        }

        public /* override */ dispose(arg1: Boolean=true): void
        {
            super.dispose(arg1);
            this._leftTime.dispose(arg1);
            this._txtLeftYB.dispose(arg1);
            this._txtLeftTB.dispose(arg1);
            this._txtLeftBox.dispose(arg1);
            this._txtMyYB.dispose(arg1);
            this._txtMyTB.dispose(arg1);
            this._txtMyBox.dispose(arg1);
            this._txtLastRank.dispose(arg1);
            this._leftTime = null;
            this._txtLeftYB = null;
            this._txtLeftTB = null;
            this._txtLeftBox = null;
            this._txtMyYB = null;
            this._txtMyTB = null;
            this._txtMyBox = null;
            this._txtLastRank = null;
            return;
        }

        public updateCopyInfo(arg1: SCountryMoneyCopyInfo): void
        {
            if (arg1 == null) 
            {
                return;
            }
            var loc1=(arg1.startDt.time - ClockManager.instance.nowDate.time) / 1000;
            var loc2=(arg1.endDt.time - ClockManager.instance.nowDate.time) / 1000;
            if (loc1 > 0) 
            {
                this._leftTime.setParse(Language.getString(80442));
                this._leftTime.setLeftTime(loc1, true);
            }
            else if (loc2 > 0) 
            {
                this._leftTime.setParse(Language.getString(80456));
                this._leftTime.setLeftTime(loc2, true);
            }
            else 
            {
                this._leftTime.text = Language.getString(80451);
            }
            this._txtLeftYB.text = Language.getStringByParam(80443, arg1.gold);
            this._txtLeftTB.text = Language.getStringByParam(80444, arg1.coin);
            this._txtLeftBox.text = Language.getStringByParam(80445, arg1.box);
            this._txtMyYB.text = Language.getStringByParam(80446, arg1.myGold);
            this._txtMyTB.text = Language.getStringByParam(80447, arg1.myCoin);
            this._txtMyBox.text = Language.getStringByParam(80448, arg1.myBox);
            return;
        }

        protected /* override */ createChildren(): void
        {
            super.createChildren();
            this._leftTime = ObjCreate.createSecTimeView(Language.getString(80442), 14, 6, 200, 20, _bodySp);
            this._leftTime.textColor = GlobalStyle.greenUint;
            var loc1=GlobalStyle.textFormat1;
            loc1.color = 16776960;
            this._txtLeftYB = ObjCreate.createGTextField("", 14, 39, 200, 20, _bodySp, loc1);
            this._txtLeftTB = ObjCreate.createGTextField("", 14, 67, 200, 20, _bodySp, loc1);
            this._txtLeftBox = ObjCreate.createGTextField("", 14, 95, 200, 20, _bodySp, loc1);
            ObjCreate.createBg(2, 115, 245, 1, _bodySp, ImagesConst.SplitLine);
            this._txtMyYB = ObjCreate.createGTextField("", 14, 124, 200, 20, _bodySp, loc1);
            this._txtMyTB = ObjCreate.createGTextField("", 14, 152, 200, 20, _bodySp, loc1);
            this._txtMyBox = ObjCreate.createGTextField("", 14, 180, 200, 20, _bodySp, loc1);
            this._txtLastRank = ObjCreate.createGTextField("", 180, 180, 200, 20, _bodySp);
            this._txtLastRank.htmlText = Language.getString(80459);
            this._txtLastRank.configEventListener(flash.events.TextEvent.LINK, this.clickLastRankHandler);
            return;
        }

        /* internal  */clickLastRankHandler(arg1: Object /* flash.events.TextEvent */): void
        {
            Dispatcher.dispatchEvent(new DataEvent(EventName.CountryMoneyShowLastRank));
            return;
        }

        /* internal */ /* var */_leftTime: SecTimerView;

        /* internal */ /* var */_txtLeftYB: GTextFiled;

        /* internal */ /* var */_txtLeftTB: GTextFiled;

        /* internal */ /* var */_txtLeftBox: GTextFiled;

        /* internal */ /* var */_txtMyYB: GTextFiled;

        /* internal */ /* var */_txtMyTB: GTextFiled;

        /* internal */ /* var */_txtMyBox: GTextFiled;

        /* internal */ /* var */_txtLastRank: GTextFiled;
    }
